import Cookies from 'js-cookie'
import config from '@/enum/setting'
/**
 * 数据存入cookie
 * @param key
 * @param value
 */
export function setCookie(key, value) {
    Cookies.set(key, value, {expires: config.loginCookieTimeOut})
}


/**
 * 删除cookie
 * @param key
 */
export function removeCookie(key) {
    Cookies.remove(key)
}


/**
 * 获取cookie
 * @param key
 * @returns {*}
 */
export function getCookie(key) {
    return Cookies.get(key);
}

/**
 * 获取token
 * @returns {boolean}
 */
export function getToken() {
    return getCookie(config.tokenCookieKey);
}
